using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using AtletIS.DomainModel.Entities.Main;

namespace AtletIS.Database.Mapping.Main
{
    public class CompetitionMap : EntityTypeConfiguration<Competition>
    {
        public CompetitionMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.City)
                .HasMaxLength(100);

            this.Property(t => t.Organiser)
                .HasMaxLength(100);

            this.Property(t => t.LanesQuality)
                .HasMaxLength(100);

            this.Property(t => t.Website)
                .HasMaxLength(100);

            this.Property(t => t.PreAttachments)
                .HasMaxLength(100);

            this.Property(t => t.PostAttachments)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Competitions");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.City).HasColumnName("City");
            this.Property(t => t.Organiser).HasColumnName("Organiser");
            this.Property(t => t.DateFrom).HasColumnName("DateFrom");
            this.Property(t => t.DateTo).HasColumnName("DateTo");
            this.Property(t => t.Deadline).HasColumnName("Deadline");
            this.Property(t => t.ClubsCountries).HasColumnName("ClubsCountries");
            this.Property(t => t.Lanes).HasColumnName("Lanes");
            this.Property(t => t.LanesQuality).HasColumnName("LanesQuality");
            this.Property(t => t.Code).HasColumnName("Code");
            this.Property(t => t.MeasurementId).HasColumnName("MeasurementId");
            this.Property(t => t.Active).HasColumnName("Active");
            this.Property(t => t.Sync).HasColumnName("Sync");
            this.Property(t => t.WebId).HasColumnName("WebId");
            this.Property(t => t.Modified).HasColumnName("Modified");
            this.Property(t => t.Public).HasColumnName("Public");
            this.Property(t => t.External).HasColumnName("External");
            this.Property(t => t.Website).HasColumnName("Website");
            this.Property(t => t.PreAttachments).HasColumnName("PreAttachments");
            this.Property(t => t.PostAttachments).HasColumnName("PostAttachments");
        }
    }
}
